package com.authorization.controller;

import cn.dev33.satoken.stp.StpUtil;
import cn.dev33.satoken.util.SaResult;
import com.authorization.service.SaLoginService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.Objects;

@RestController
public class SaToken {
    @Autowired
    SaLoginService saLoginService;

    @RequestMapping("/login")
    public SaResult doLogin(String username, String password) {

        return saLoginService.login(username, password);
    }

    @RequestMapping("isLogin")
    public String isLogin() {
        return "当前会话是否登录：" + StpUtil.isLogin();
    }
}
